package com.qj.yantaishan.controller;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.extension.service.IService;
import com.qj.yantaishan.common.core.domain.R;
import com.qj.yantaishan.vo.OrderReturnVo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.qj.yantaishan.common.annotation.Log;
import com.qj.yantaishan.common.enums.BusinessType;
import com.qj.yantaishan.domain.Return;
import com.qj.yantaishan.service.IReturnService;
import com.qj.yantaishan.common.core.controller.BaseController;
import com.qj.yantaishan.common.core.domain.AjaxResult;
import com.qj.yantaishan.common.utils.poi.ExcelUtil;
import com.qj.yantaishan.common.core.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 *
 * @author qihe
 * @date 2022-07-22
 */
@RestController
@RequestMapping("/yantaishan/Return")
public class ReturnController extends BaseController {
    private String prefix = "yantaishan/Return";

    @Autowired
    private IReturnService returnService;

    @GetMapping("detail")
    public R getReturnDetail(@RequestParam(required = true) Integer returnId) {
        Return returnOrder = returnService.getReturnOrderDetail(returnId);
        return R.ok(returnOrder);
    }

    @GetMapping("list")
    public R getReturnList(@RequestParam(required = false, defaultValue = "1") Integer currentPage,
                           @RequestParam(required = false, defaultValue = "10") Integer pageSize,
                           @RequestParam(required = false, defaultValue = "0") String returnNo,
                           @RequestParam(required = false, defaultValue = "0") String thirdId,
                           @RequestParam(required = false, defaultValue = "0") Integer status) {

        Map<String, Object> returnVoList = returnService.getReturnList(currentPage, pageSize, returnNo, thirdId, status);
        return R.ok(returnVoList);
    }

    @PutMapping("add/audit")
    public R addAudit(@RequestBody Map<String, String> audit) {
        returnService.addAudit(audit);
        return R.ok();
    }


}
